﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Kingdee.BOS.WebApi.Client;
using Kingdee.BOS.WebApi.DataEntify;
using Microsoft.Office.Interop.Excel;
using NPOI.OpenXmlFormats.Dml.Diagram;

namespace LanDBom.Models
{
    public class Find_ShoTJ
    {
        LDbaseEntities LD = new LDbaseEntities();
        public List<List<object>> Get_ShoTJ()
        {
            var client = new K3CloudApi();
            //用于记录结果
            StringBuilder Info = new StringBuilder();
            //业务对象标识
            string formId = "BD_RecCondition";
            string fieldKeys = "FName,FNumber,FAccountTimeJudge";//客户 编码 联系电话 邮箱 通讯地址 备注 省份
            string Filter = "";
            //请求参数，示例使用的是SDK提供的模板类，还可以使用字符串拼接等方式
            var param = new QueryParam()
            {
                FormId = formId,
                FieldKeys = fieldKeys,
                FilterString = Filter,
                TopRowCount = 0,
                StartRow = 0,
                Limit = 200,
            };
            //调用接口
            var result = client.ExecuteBillQuery(param.ToJson());
            
            return result;
        }

        public Applications BGAPP(Applications App, string SJbia, int JBIG,string ABF)
        {
            var shuj = new Applications()
            {
                AP_ren = App.AP_ren,
                AP_bian = SJbia,
                App_Kehu = App.App_Kehu,
                App_qishi = App.App_qishi,
                App_miao = App.App_miao,
                APP_name = App.APP_name,
                App_JTime = App.App_JTime,
                App_dizhi = App.App_dizhi,
                APP_Zhong = App.APP_Zhong,
                App_ju = App.App_ju,
                App_mu = App.App_mu,
                App_sho = App.App_sho,
                App_bu = App.App_bu,
                App_lei = App.App_lei,
                App_bei = ABF,
                App_tuzhi = App.App_tuzhi,
                APP_fenL = App.APP_fenL,
                APP_she = App.APP_she,
                App_BanB = JBIG.ToString(),
                App_zhand = App.App_zhand,
                App_zhuang = App.App_zhuang,
                APP_shr = App.APP_shr,
                APP_liy = App.APP_liy,
                App_hangda = App.App_hangda,
                App_hangxiao = App.App_hangxiao,
                App_baozhuangwu = App.App_baozhuangwu,
                App_fzr = App.App_fzr,
                App_Jz = App.App_Jz,
                App_JL = App.App_JL,
                App_xmzt = App.App_xmzt,
                App_cd = App.App_cd,
                AP_BGYY = App.AP_BGYY,
                AP_QTJY = App.AP_QTJY
            };
            return shuj;
        }

        public BOMini BO(BOMini f,string SJbia, int JBIG)
        {
            var BOMi = new BOMini()
            {
                BOM2_bian = SJbia,
                BOM2_chen = f.BOM2_chen,
                Fo_id = f.Fo_id,
                BOM2_wuLiu = f.BOM2_wuLiu,
                BOM2_liao = f.BOM2_liao,
                BOM2_duan = f.BOM2_duan,
                BOM2_Guige = f.BOM2_Guige,
                BOM2_Nian = f.BOM2_Nian,
                BOM2_Yong = f.BOM2_Yong,
                BOM2_fenzi = f.BOM2_fenzi,
                BOM2_Gong = f.BOM2_Gong,
                BOM2_sunhao = f.BOM2_sunhao,
                BOM2_Lei = f.BOM2_Lei,
                BOM2_Ctime = f.BOM2_Ctime,
                BOM2_mioa = f.BOM2_mioa,
                BOM2_BQing = f.BOM2_BQing,
                BOM2_Zhuang = JBIG.ToString(),
                BOM2_Jin = f.BOM2_Jin,
                BOM2_Sone = f.BOM2_Sone,
                BOM2_ST = f.BOM2_ST,
                BOM2_CB = f.BOM2_CB,
                BOM2_bei = f.BOM2_bei,
                BOM2_GY = f.BOM2_GY,
                BOM2_sd = f.BOM2_sd,
                BOM2_sdname = f.BOM2_sdname,

            };
            return BOMi;
        }
        public Designdraw Des(Designdraw f, string SJbia, int JBIG,string BZ)
        {
            var BOMi = new Designdraw()
            {
                D_Applic = f.D_Applic,
                D_reDate = f.D_reDate,
                D_take = f.D_take,
                D_App = f.D_App,
                D_AppRevi = f.D_AppRevi,
                D_Ton = SJbia,
                D_CN = f.D_CN,
                D_PN = f.D_PN,
                D_DE = f.D_DE,
                D_LV = f.D_LV,
                D_DT = f.D_DT,
                D_PW = f.D_PW,
                D_SI = f.D_SI,
                D_OI = f.D_OI,
                D_MOF = f.D_MOF,
                D_PT = f.D_PT,
                D_PR = f.D_PR,
                D_OR = f.D_OR,
                D_SR = f.D_SR,
                D_PA = f.D_PA,
                D_REC = f.D_REC,
                D_AR = f.D_AR,
                D_CD = f.D_CD,
                D_TCA = f.D_TCA,
                D_zhuang = BZ,//分配人员
                D_kong = f.D_kong,
                D_price = f.D_price,
                D_dhr = f.D_dhr,
                D_dhly = f.D_dhly,
                D_JL = f.D_JL,
            };
            return BOMi;
        }
    }
}